$(function(){
	function addAbilityUpdater(item) {
		var action = $('form#myabilities input[name=a]');
		action.val(Action.ADDABILITY);
		var name = $('form#myabilities input[name=name]');
		name.val(item);
		$('form#myabilities').submit();
		return item;
	}
	
	// Just for profile user
	setAutocomplete(AddAbility.QUERY, Action.AUTOCOMPLETEABILITY,
			$('form#myabilities'), addAbilityUpdater);
});

function removeAbility(name){
	var action = $('form#myabilities input[name=a]');
	action.val(Action.REMOVEABILITY);
	var nameInput = $('form#myabilities input[name=name]');
	nameInput.val(name);
	$('form#myabilities').submit();
}